<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVideoTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('videos', function (Blueprint $table) {
            $table->increments('id');
            $table->string('video_name');
            $table->char('speaker_name',100);
            $table->string('coverurl')->nullable();
            $table->integer('play_count')->default(0);
            $table->string('description')->nullable();
            $table->string('play_url');
            $table->string('download_url');
            $table->tinyInteger('source_type')->comment('视频来源：1、录制2、平台上传3、手机端,4直播视频5教研视频')->default(1);
            $table->tinyInteger('iscutflag')->comment('剪切标志，0，不是剪切的，1，剪切的')->default(0);
            $table->char('duration',10)->comment('视频时长')->nullable();
            $table->integer('filesize')->comment('视频大小,单位M')->default(0);
            $table->integer('school_id');
            $table->char('create_user_name');
            $table->integer('class_id')->comment('所属班级(若有)')->nullable();
            $table->tinyInteger('type')->comment('视频类型(0、私有1、公开组2、学科优课3首页公开/名师优课)')->default(0);
            $table->integer('phase_id')->comment('学段')->nullable();
            $table->integer('subject_id')->comment('学科')->nullable();
            $table->integer('grade_id')->comment('年级')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('videos');
    }
}
